package com.jweb.framework.ws.soap.axiom;

import javax.xml.transform.Result;
import javax.xml.transform.Source;

import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPFactory;
import org.springframework.ws.soap.SoapBody;
/**
 * 修改人： Thomas
 * 修改内容：新增 
 * 类说明：
 */
abstract class AxiomSoapBody extends AxiomSoapElement implements SoapBody {
	
	private final Payload payload ;
	
	protected AxiomSoapBody(SOAPBody axiomBody , SOAPFactory axiomFactory , boolean payloadCaching) {
		
		super(axiomBody , axiomFactory);
		
		if(payloadCaching){// true
			payload = new CachingPayload(axiomBody, axiomFactory);
		}
		else {
			payload = new NonCachingPayload(axiomBody , axiomFactory);
		}
	}
	
	public Source getPayloadSource(){
		return payload.getSource();
	}
	
	public Result getPayloadResult(){
		return payload.getResult();
	}
	
	public boolean hasFault(){
		return getAxiomBody().hasFault();
	}
	
	protected final SOAPBody getAxiomBody(){
		return (SOAPBody) getAxiomElement();
	}

	

}